define(function(require, exports, module) {
	var Mobilebone = require('mobilebone');
	var Page={};
	Page.pageHome=require("moduls/pageHome");
	Page.ProductCategary=require("moduls/ProductCategary");
	Page.shopCart=require("moduls/shopCart");
	Page.user=require("moduls/user");
	Mobilebone.onpagefirstinto = function(pageinto) {
		Page[pageinto.id] && Page[pageinto.id].init(pageinto);
		var ele_screen_shot = null, src_screen_shot = '';
		if (pageinto.id == "pageChatList" && (ele_screen_shot = document.getElementById("screenShot"))) {
			src_screen_shot = ele_screen_shot.getAttribute("data-src");
			if (!ele_screen_shot.src) ele_screen_shot.src = src_screen_shot;
			ele_screen_shot.width = window.innerWidth;
			ele_screen_shot.height = Math.round(ele_screen_shot.width * 2405 / 720);
		}
		
	};
	Mobilebone.callback = function(pageinto, pageout) {
		var header = document.querySelector("body > .header"), footer = document.querySelector("body > .footer");
		var ele_link_in = null, ele_link_out = null;
		var ele_header_in = null, ele_header_out = null;
		if (pageinto) {
			ele_link_in = footer.querySelector("a[href$="+ pageinto.id +"]");
			ele_header_in = pageinto.querySelector(".header");
			if (pageout) {
				ele_link_out = footer.querySelector("a[href$="+ pageout.id +"]");
				ele_header_out = pageout.querySelector(".header");
			} else if (ele_header_in == null) {
				header.className = "header in";	
				footer.className = "footer in";		
			}
			if (ele_header_in == null) {
				ele_link_in && ele_link_in.classList.add("active");
				ele_link_out && ele_link_out.classList.remove("active");
				
				if (ele_header_out != null) {
					header.className = "header slide reverse in";	
					footer.className = "footer slide reverse in";		
				}
			} else if (pageout && ele_header_out == null) {
				header.className = "header slide out";	
				footer.className = "footer slide out";	
			}
		}
		var pageId=pageinto.id;
		console.log(pageId);
		var Tab=require("moduls/tab");
		var tab=new Tab();
		tab.switchHeader(pageId);
	};
	Mobilebone.init();
});